.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\" Copyright 2014 Joyent, Inc.
.\" Copyright 2016 Nexenta Systems, Inc.
.\"
.Dd July 20, 2016
.Dt DISKINFO 8
.Os
.Sh NAME
.Nm diskinfo
.Nd provide disk device inventory and status
.Sh SYNOPSIS
.Nm
.Op Fl Hp
.Op Fl c Ns | Ns Fl P
.Sh DESCRIPTION
The diskinfo tool provides information about the disk devices in the system.
Because it interacts with the kernel's device management subsystem, this tool
can be used only from the global zone.
If run in any other zone, its output will be incomplete and unreliable.
.Pp
There are three main modes.
The default mode, when neither the
.Fl c
nor
.Fl P
option is specified, provides a basic inventory of the disk devices in the
system.
Each line describes a single device and contains the device's attachment bus or
fabric type, the base name of the device in the
.Pa /dev/dsk
directory, the disk's vendor and product identification strings, the size
.Pq storage capacity
of the device, whether the device is removable, and whether it is solid-state.
.Pp
The
.Fl P
option selects physical mode.
In this mode, each line of output likewise describes one disk device; however,
the fields provided indicate the base name of the device in the
.Pa /dev/dsk
directory, the disk's vendor and product identification strings, the serial
number of the device, whether the device is faulty as diagnosed by
.Xr fmd 8 ,
whether the locate or identification indicator is on for the device
.Pq if one is present ,
and the chassis and bay number containing the disk if known.
.Pp
The
.Fl c
option selects compact mode.
This mode provides all of the information provided by both the default mode and
physical mode in a compact format.
.Pp
See
.Sx OUTPUT FIELDS
below for a detailed description of each column.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl c
Select compact mode output.
At most one of
.Fl c
and
.Fl P
may be present on the command line.
.It Fl H
Do not print a header.
This provides output suitable for passing into text processing tools.
.It Fl P
Select physical mode output.
At most one of
.Fl P
and
.Fl c
may be present on the command line.
.It Fl p
Parsable output.
When
.Fl p
is selected, the size
.Pq storage capacity
is output in bytes instead of in human-readable units, and the device's location
.Pq if known
is provided as a comma-separated chassis and bay number instead of a
human-readable location.
This option may be used in any output mode and is intended for use by scripts or
other robotic tooling.
.El
.Sh OUTPUT FIELDS
.Bl -tag -width "LOCATION"
.It Sy DISK
The base name of the device node within the
.Pa /dev/dsk
directory.
The names of partitions and/or slices, if any, are derived from this name as
described by
.Xr prtvtoc 8 .
.Pp
This field is available in all output modes.
.It Sy FLRS
A condensed field incorporating the same information as the
.Sy FLT , LOC , RMV ,
and
.Sy SSD
fields.
Each field is condensed to a single character.
If the field is true, the first letter of the field name will appear in its
position in the string; otherwise, the
.Qq Sy -
character will appear instead.
.Pp
This field is available only in compact output mode.
.It Sy FLT
A boolean field indicating whether the device is faulty; specifically, whether
the fault indicator
.Pq if one is present
is active.
.Pp
This field is available only in physical output mode.
.It Sy LOC
A boolean field indicating whether the locate or identify indicator, if any,
associated with the device's bay, is active.
.Pp
This field is available only in physical output mode.
.It Sy LOCATION
The physical chassis and bay name
.Po or chassis and bay numbers, if
.Fl p
is given
.Pc
in which the device is located.
The chassis number is identified in human-readable output within
.Bq square brackets ;
chassis 0 is the host chassis itself.
The bay name, if any, is provided by the enclosure, typically via a SCSI
Enclosure Services processor.
.Pp
This field is available in compact and physical output modes.
.It Sy PID
The product identification string reported by the device.
.Pp
This field is available in all output modes.
.It Sy RMV
A boolean field indicating whether the device is removable.
USB storage devices, most optical drives and changers, and certain other devices
that report themselves as removable will be identified as such.
.Pp
This field is available only in default output mode.
.It Sy SERIAL
The serial number of the device.
The entire serial number is reported if the device and its drivers provide it.
.Pp
This field is available in compact and physical output modes.
.It Sy SIZE
The device's storage capacity.
If the
.Fl p
option is given, this is reported in bytes; otherwise, it is reported in a
human-readable format with units specified.
All units are based on powers of 2 and are expressed in SI standard notation.
.Pp
This field is available in compact and default output modes.
.It Sy SSD
A boolean field indicating whether the device is solid-state.
.Pp
This field is available only in default output mode.
.It Sy TYPE
The transport
.Pq fabric or bus
type by which the storage device is attached to the host, if known.
Typical transports include SCSI and USB.
.Pp
This field is available in compact and default output modes.
.It Sy VID
The vendor identification string reported by the device.
.Pp
This field is available in all output modes.
.El
.Sh SEE ALSO
.Xr sd 4D ,
.Xr fmd 8 ,
.Xr prtvtoc 8
